<?php

class treenode {

	private $name;
	private $attributes;
	private $childs;
	private $value;

	function __construct($name,$attributes,$childs,$text) {
		$this->name = $name;
		$this->attributes = $attributes;
		$this->childs = $childs;
		$this->value = $text;
	}

	public function getname() {
		return $this->name;
	}

	public function getattributes() {
		return $this->attributes;
	}

	public function getchilds() {
		return $this->childs;
	}
	
	public function getvalue() {
		return $this->value;
	}
	

	public function has_childs()
	{
		if($this->childs != null)
			return 1;
		else
			return -1;
	}
	
	public function get_next_child()
	{
		if(($this->childs != null) && $this->current_child != sizeof($this->childs))
		{
			return $this->childs[$this->current_child];
			$this->current_child++;
		}
		else
			return null;
	}
	
	public function count_childs()
	{
		return sizeof($this->childs);
	}
	
	public function count_attributes()
	{
		return sizeof($this->attributes);
	}
	
}